package com.ynny.chapter05.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ynny.chapter05.entity.User;
import com.ynny.chapter05.mapper.UserMapper;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl
        extends ServiceImpl<UserMapper , User>
        implements UserService{



    public PageInfo page(int pageNum, int pageSize){
        //开启分页

        PageHelper.startPage(pageNum,pageSize);

        //查询所有

        List<User> users = list();

        PageInfo<User> userPageInfo = new PageInfo<>(users);

        return userPageInfo;

    }
}
